using System;
using System.Collections.Generic;
using System.Text;

using System.Management.Automation;

namespace Microsoft.PowerShell.CmdletManagement
{
    [Cmdlet(VerbsCommon.Get, "PsSpecCmdletParameterGroupEntry")]
    public class GetPsSpecCmdletParameterGroupEntryCommand : PsSpecCommandBase
    {
        [Parameter(Mandatory = false, Position = 0, ValueFromPipelineByPropertyName = true)]
        [ValidateLength(1, 50)]
        public String ProjectName
        {
            get
            {
                return _projectName;
            }
            set
            {
                _projectName = value;
            }
        }
        private string _projectName = "*";

        protected override void ProcessRecord()
        {
            PsSpecCmdletService.PsSpecCmdletParameterGroupEntry[] parameters = null;

            parameters = Service.GetTopParameters(PsSpecCmdletUtils.ConvertWildcardToSqlWildcard(ProjectName));

            foreach (PsSpecCmdletService.PsSpecCmdletParameterGroupEntry parameter in parameters)
            {
                WriteObject(new PsSpecCmdletParameterGroupEntry(
                    parameter.Count, parameter.ParameterName, parameter.Type, parameter.Description));
            }
        }
    }
}
